<?php
if(!isset($_SESSION))
{
	session_start();
}
include '../../connection/connection.php';
include "../../value/value_kr.php";

$winH = $_REQUEST['winH'];

if ( !isset($_REQUEST['page'] ))
	{
    	$page = 1 ;
	}else{
		$page = $_REQUEST['page'] ;
	}
	
	$list=$_SESSION['sort'];
	//$str=$_GET['str'];
	//$_SESSION['sortn']=$str;
	
	if(!isset($_REQUEST['page'])){
		$list["p.ip"]="DESC";
		$list["p.name"]="DESC";
		$list["p.used_hardisk"]="DESC";
		$list["p.total_hardisk"]="DESC";
		
		$str="p.name";
		
		$_SESSION['sortn']=$str;
		$_SESSION['sort']=$list;
	}else{
		$str=$_SESSION['sortn'];
		$list=$_SESSION['sort'];
	}
	
$sql = "SELECT p.* FROM pc p";
$selectPC = mysql_query($sql." ORDER BY ".$str." ".$list[$str], $connection);

$_SESSION['sort']=$list;
	
?>
<div style="overflow:scroll;overflow-x: hidden; width:100%; height:<?php echo ($winH-280)."px"?>; background-color: #ffffff">
	        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="tbchung" id="tablebody2">
	            <tbody>
	            <?php 
	            		$i = 0; 
				     		while ($row = mysql_fetch_array($selectPC)){ 
				     			$i++;?>
	            <tr id="idrowpc" onclick="onclickRowPC(this,'<?=$row[ip]?>');">
	            	<td style="width: 5%"><?=$i?></td>
	                <td style="width: 25%"><?=$row[ip]?></td>
	                <td style="width: 30%"><?php if ($row[name]==''){echo "&nbsp;";}else{?> <?=$row[name]?><?php }?></td>
	                <td style="width: 20%"><?php if ($row[total_hardisk]==''){echo "&nbsp;";}else{?> <?=$row[total_hardisk]?><?php }?></td>
	                <td style="width: 20%;border-right: none !important;" class="last"><?php if ($row[used_hardisk]==''){echo "&nbsp;";}else{?> <?=$row[used_hardisk]?><?php }?></td>
	            </tr>
	            <?php 
				     	}
						if ($i>0 and $i<($winH/28)) {
							 	foreach(range(0,($winH/28)-$i) as $real){
							 		?>
							 		<tr>
								 		<td width="5%">&nbsp;</td>
								 		<td width="25%">&nbsp;</td>
								 		<td width="30%">&nbsp;</td>
									 	<td width="20%">&nbsp;</td>
									 	<td class="last" style="width: 20%;border-right: none !important;">&nbsp;</td>
								 	</tr>
							 	<?php }
							}?>
	            </tbody>              
	        </table>
	        </div>
      <?php mysql_close($connection);?>